package org.halk.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class BIOServer {

    public static void main(String[] args) throws IOException {

        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(100, 200,
                30, TimeUnit.SECONDS, new LinkedBlockingQueue<>());


        ServerSocket serverSocket = new ServerSocket(6688);
        System.out.println("服务器启动，创建连接！");

        while (true) {
            Socket socket = serverSocket.accept();
            System.out.println("收到客户端连接");
            InputStream inputStream = socket.getInputStream();
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
            System.out.println("读取客户端发送的内容：");
            System.out.println(bufferedReader.readLine());
        }

    }
}
